package logic

import (
	"context"
	"goods_srv/model/mysql"

	"goods_srv/goods"
	"goods_srv/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetGoodsDetailLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGetGoodsDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetGoodsDetailLogic {
	return &GetGoodsDetailLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *GetGoodsDetailLogic) GetGoodsDetail(in *goods.GetGoodsDetailRequest) (*goods.GetGoodsDetailResponse, error) {
	g := mysql.Goods{}
	err := g.Detail(int(in.GoodsId))
	if err != nil {
		logx.Error("获取商品详情失败", err)
		return nil, err
	}
	return &goods.GetGoodsDetailResponse{}, nil
}
